package com.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.entity.Help;
import com.entity.Notice;
import com.mapper.NoticeMapper;

@Service
public class NoticeService {
	@Autowired 
	NoticeMapper noticeMapper;
	public void test() {
		Notice notice=new Notice();
    	notice.setTime("2021-06-20");
    	notice.setNotice_id(2);
    	notice.setNotice_info("qeqwe12343241d234");
       this.noticeMapper.insertNotice(notice);
       
       this.noticeMapper.deleteNoticeById("1");
       System.err.println(this.noticeMapper.queryNotice());
	}
	
	/**查询以过求助*/
    public Integer LookNoticeCount() {
    	return noticeMapper.LookNoticeCount();
    }
    /**查询以过求助总数 */
   	public List<Notice> queryAllNotices(int limit, int page){
   		return noticeMapper.queryAllNotices(limit, page);
   	}
	
	/**插入公告*/
	public Integer insertNotice(Notice notice) {
		return this.noticeMapper.insertNotice(notice);
	}
	
	/**删除公告*/
    public Integer deleteNoticeById(String id) {
    	return this.deleteNoticeById(id);
    }
    
    /**查询前5条通知*/
    public List<Notice> queryNotice(){
    	return this.noticeMapper.queryNotice();
    }
}
